package hu.elte.inf.holiuml.model;

import hu.elte.inf.holiuml.coordgeom.LineSegment;

import java.awt.BasicStroke;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Stroke;
import java.util.Vector;

/**
 * @author Hoch Csaba
 */
public class CommentEdge extends Edge {

	private Node nodeBegin = null;
	private Node nodeEnd = null;

	public CommentEdge() {
	}

	public CommentEdge(Node nodeBegin, Node nodeEnd) {
		this.nodeBegin = nodeBegin;
		this.nodeEnd = nodeEnd;
	}

	@Override
	public void draw(Graphics g) {

		Graphics2D g2 = null;
		Stroke oldStroke = null;

		try {
			g2 = (Graphics2D) g;
			oldStroke = g2.getStroke();
			float dp[] = { 10.0f, 5.0f };
			Stroke stroke = new BasicStroke(1, BasicStroke.CAP_BUTT,
					BasicStroke.JOIN_BEVEL, 0.0f, dp, 0.0f);
			g2.setStroke(stroke);
		} catch (Exception e) {
		}
		
		LineSegment ls = getLineSegment();
		if (ls != null) {
			g.setColor(java.awt.Color.BLACK);
			ls.draw(g);
		}
		
		if (g2 != null) {
			g2.setStroke(oldStroke);
		}
	}

	@Override
	public Node getNodeBegin() {
		return nodeBegin;
	}

	@Override
	public Node getNodeEnd() {
		return nodeEnd;
	}

	@Override
	public void setNodeBegin(Node nodeBegin) {
		this.nodeBegin = nodeBegin;
	}

	@Override
	public void setNodeEnd(Node nodeEnd) {
		this.nodeEnd = nodeEnd;
	}

	@Override
	public Vector<String> getTextVector() {
		return null;
	}

}
